/*
 * @Author: wurangkun
 * @Date: 2024-05-14 09:14:32
 * @LastEditTime: 2024-05-14 10:53:12
 * @LastEditors: wurangkun
 * @FilePath: \flutter_example\lib\util\router.dart
 * @Description: 
 */
import 'package:flutter/material.dart';

// class RouterPostion {
//   final toLeft;
// }

class CustomRouter {
  Route createRoute(Widget widget) {
    return PageRouteBuilder(
      pageBuilder: (context, animation, secondaryAnimation) => widget,
      transitionsBuilder: (context, animation, secondaryAnimation, child) {
        const begin = Offset(1.0, 0.0);
        const end = Offset.zero;
        const curve = Curves.ease;

        var tween =
            Tween(begin: begin, end: end).chain(CurveTween(curve: curve));

        return SlideTransition(
          position: animation.drive(tween),
          child: child,
        );
      },
    );
  }
}
